class Solution {
    public:
        vector<int> twoSum(vector<int>& numbers, int target) {
            vector<int> ans(2);
            int l=0;
            int r=numbers.size()-1;
            while(numbers[l]+numbers[r]!=target){
                if(numbers[l]+numbers[r]>target){
                    r--;
                }else{
                    l++;
                }
            }
            ans[0]=l+1;
            ans[1]=r+1;
            return ans;
        }
    };